// components/helper/helper.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    text:String,
    show:Boolean,
    position:String
  },


  /**
   * 组件的初始数据
   */
  data: {
    url:"/images/10.png",
    url_active:"/images/3.png",
    show:false,
    animation:'',
    content:"我是你的小助手哦"
  },
  
  observers:{
    "text":function(value){
      this.setData({content:value})
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    showImage(){
      const that = this
        let animation = wx.createAnimation({
          delay: 0,
          duration: 500,
          timingFunction: 'ease',
        })
        let animation1 = wx.createAnimation({
          delay: 0,
          duration: 500,
          timingFunction: 'ease',
        })
          
          animation.translateX(-60).step()
          this.setData({
            animation:animation,
          })
          setTimeout(()=>{
            that.setData({show:!that.data.show})
            that.recover()
          },500)
      },
      recover(){
        let animation = wx.createAnimation({
          delay: 0,
          duration: 500,
          timingFunction: 'ease',
        })
        animation.translateX(0).step()
        this.setData({
          animation:animation
        })
      },
      
  }
})
